var $sql={
	init: function(dbf){
		var file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
		file.append(dbf);
		var storageService = Components.classes["@mozilla.org/storage/service;1"].getService(Components.interfaces.mozIStorageService);
		return storageService.openDatabase(file);
	},
	stmt: function(obj,str){
		var statement=obj.createStatement(str);
		var storageWrapper = Components.classes["@mozilla.org/storage/statement-wrapper;1"].createInstance(Components.interfaces.mozIStorageStatementWrapper);
		storageWrapper.initialize(statement);
		
		
		var rowInfo = [];
		for (var i = 0; i < statement.columnCount; ++i) {
			rowInfo.push({name: statement.getColumnName(i)});
		}

		var colInfo = [];
		
		while (storageWrapper.step()) {
			var colData = {};
			for (var i = 0; i < rowInfo.length; ++i) {
				colData[rowInfo[i].name]=storageWrapper.row[rowInfo[i].name];
			}
		//	this.log($json.encode(colData));
 			colInfo.push(colData);
		}
	//	alert($json.encode(colInfo))

		return colInfo;
	},
	log: function (str){
		Components.classes['@mozilla.org/consoleservice;1'].getService(Components.interfaces.nsIConsoleService).logStringMessage(str);
	},
}